<?php


namespace RedMVC\Form\Filter;

/**
 * Whitelist class
 *  
 * @category    RedMVC
 * @package     Form
 * @subpackage  Filter 
 * @author      Jan Fischer, bitWorking <info@bitworking.de>
 */
class Whitelist extends AFilter{

    protected $_charList;

    public function __construct($charList = 'a-zA-Z0-9äüöÄÜÖß\'"#.,:;()=+\-*!?%&_/|@ '){
        $this->_charList = $charList;
    }

    public function filter($value){
        if(is_string($value)){
            return preg_replace("~[^".$this->_charList."]+~","", $value);
        }
        return $value;
    }
}